import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import platformHomeView from "@/views/platformHomeView.vue";

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect:'/user',
    meta:{
      title:'首页'
    },
    children:[
      {path: '/user', component: () => import('@/views/shop/user/UserView.vue')},
      {path: '/userGroup', component: () => import('@/views/shop/user/UserGroupView.vue')},
      {path: '/activity', component: () => import('@/views/shop/activity/ActivityView.vue')},
      {path: '/coupon', component: () => import('@/views/shop/activity/CouponView.vue')},
      {path: '/article', component: () => import('@/views/shop/content/ArticleView.vue')},
      {path: '/articleList', component: () => import('@/views/shop/content/ArticleListView.vue')},
      {path: '/articleCreate', component: () => import('@/views/shop/content/ArticleCreateView.vue')},
      {path: '/store', component: () => import('@/views/shop/store/StoreView.vue')},
      {path: '/message', component: () => import('@/views/shop/message/MessageView.vue')},
      {path: '/messagePush', component: () => import('@/views/shop/message/MessagePushView.vue')},
    ]
  },
  {
    path: '/platform',
    name: 'platformHome',
    component: platformHomeView,
    redirect:'/admin',
    meta: {
      requiresAuth: true, // 标记需要登录
      role: 'platform' // 平台专属页面
    },
    children:[
      {path: '/admin', component: () => import('@/views/platform/admin/AdminView.vue')},
      {path: '/adminList', component: () => import('@/views/platform/admin/AdminListView.vue')},
      {path: '/tagsList', component: () => import('@/views/platform/tags/TagsListView.vue')},
      {path: '/authorManage', component: () => import('@/views/platform/authorManage/AuthorManageView.vue')},
      {path: '/messageTouch', component: () => import('../views/platform/message/RoofTouchView.vue')},
      {path: '/messageBehave', component: () => import('../views/platform/message/MessageBehaveView.vue')},
    ]
  },
  {path: '/login', component: () => import('../views/LoginView')}
]
const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router